package com.dts.yjnb.service.service.impl;

import com.dts.yjnb.service.domain.Category;
import com.dts.yjnb.service.domainDto.ProductDTO;
import com.dts.yjnb.service.service.ICategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.dts.yjnb.service.mapper.CategoryMapper;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;

/**
 * 分类 服务层实现
 *
 * @author dts
 */
@Service
public class CategoryServiceImpl implements ICategoryService
{
    @Autowired
    private CategoryMapper categoryMapper;


    @Override
    public List<Category> getlist() {
        //响应的全部分类数组
        List<Category> list = new ArrayList<Category>();

        //全部分类
        Category allCategory = new Category();
        allCategory.setId(0L);
        allCategory.setName("全部");
        allCategory.setType(0);

        //查询其他所有分类
        list = categoryMapper.getlist();
        list.add(0, allCategory);
        return list;
    }
}
